<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="pub/top_list2.jsp"%>

<%
	int orderid = Integer.valueOf(request.getParameter("orderid"));
	int state = Integer.valueOf(request.getParameter("state"));

	String sql = "select a.*,b.*,c.*,d.othername,e.classify,f.* from dingdan a,dingdanmx b,goodsx c,goodinfo d,shuxing e,manageadd f where a.orderid=? and a.orderid=b.orderid and a.state=? and b.goodsxID=c.goodsxID and a.addr=f.id and c.productid=d.productid and c.sxid=e.sxid";
	Object[] params = new Object[2];
	params[0] = orderid;
	params[1] = state;
	Map<String, Object> map = db.queryMap(sql, params);
%>

<style>
#dfk {
	width: 100%;
	padding: 6% 0;
	height: margin-top:5%;
	background-color: #ff5809;
	font-weight: normal;
	text-align: center;
}

#dfk1 {
	font-size: 1.5em;
	color: #fff;
	float: left;
	margin-left: 4%;
	vertical-align: middle;
}
</style>

<body>
	<header class="top-header fixed-header">
		<a class="icona" href="javascript:history.go(-1)"> <img
			src="images/left.png" />
		</a>
		<h3>订单详情</h3>
	</header>
	<div class="contaniner fixed-cont">
		<section class="go-order">
			<div id="dfk" style="">
				<div id="dfk1">
					<%
						if (state == 1) {
					%>
					<span style="float: left">等待买家付款</span><br> <span
						style="font-size: 14px">剩余23小时59分自动关闭</span>
					<%
						} else if (state == 2) {
					%>
					<span style="float: left">买家已付款</span>
					<%
						} else if (state == 3) {
					%>
					<span style="float: left">等待买家付款</span><br> <span
						style="font-size: 14px">还剩9天5时自动确认</span>
					<%
						} else {
					%>
					<span style="float: left">交易成功</span>
					<%
						}
					%>
				</div>
				<img src="images/b-iocn01.png" />
			</div>

			<dl class="map">
				<dt>
					<img src="images/a-icon02.png" />
				</dt>
				<dd>
					<%
						String province = (String) map.get("province");
						String city = (String) map.get("city");
						String distric = (String) map.get("distric");
						String address = (String) map.get("address");
						String xxaddr = province + city + distric + address;
					%>
					<span><%=map.get("username")%></span> <small><%=map.get("telephone")%></small>
					<p><%=xxaddr%></p>
				</dd>
			</dl>
			<div class="order-shop">
				<%
					BigDecimal oprice = new BigDecimal(map.get("oprice").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
					int ocount = (Integer) map.get("ocount");
					BigDecimal consume = oprice.multiply(BigDecimal.valueOf(ocount));
					BigDecimal yunfei = new BigDecimal(map.get("yunfei").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
				%>
				<dl>
					<a href="detail.jsp">
						<dt>
							<img src="<%=map.get("sximg")%>" />
						</dt>
						<dd>
							<p><%=map.get("othername")%></p>
							<small><%=map.get("classify")%>:<%=map.get("sxname")%></small>

							<!-- <span>尺寸：L</span> -->
							<%
								if (state == 3) {
							%>
							<input type="button" value="退货/退款" />
							<%
								}
							%>
							<b><%=oprice%></b> <strong>×<%=ocount%></strong>
						</dd>
					</a>

				</dl>
				<ul>
					<li><span>运费</span> <small><%=yunfei%></small></li>
					<li><span>商品总额</span> <small>￥<%=consume%></small></li>
					<li>
						<p>
							下单时间：<%=map.get("ordertime")%><br />订单编号：<%=map.get("ddswift")%>
						</p>
					</li>
				</ul>
			</div>
		</section>
	</div>

	<footer class="order-footer fixed-footer">
		<%
			if (state == 1) {
		%>
		<input type="submit" value="取消订单" /> 
		<input type="button" value="付款" onclick="javascript:location.href='wuliu.jsp'" />
		<%
			} else if (state == 2) {
		%>
			<input type="submit" value="提醒发货" /> 
			<input type="button" value="查看物流" onclick="javascript:location.href='wuliu.jsp'" />
		<%
			} else if (state == 3) {
		%>
			<input type="button" value="查看物流" onclick="javascript:location.href='wuliu.jsp'" />
			<input type="submit" value="确认收货" /> 
		<%
			} else {
		%>
			<input type="button" value="查看物流" onclick="javascript:location.href='wuliu.jsp'" />
			<input type="submit" value="评价" />
		<%
			}
		%>
		

	</footer>



</body>
</html>